package RBT;

import BST.BsTreeNode;

/**
 * 红黑树节点定义
 *
 * @author Lwh
 * @time 2022/11/11 02:11
 */
public class RbTreeNode <T extends Comparable<T>> extends BsTreeNode<T> {
    /*颜色，黑-true /  红-false */
    boolean color;
    /*关键字（键值）*/
    T nodeKey;
    /*左孩子*/
    RbTreeNode<T> left;
    /*右孩子*/
    RbTreeNode<T> right;
    /*父节点*/
    RbTreeNode<T> parent;

    public RbTreeNode(T key, boolean color, RbTreeNode<T> parent,
                      RbTreeNode<T> left, RbTreeNode<T> right) {
        this.nodeKey = key;
        this.color = color;
        this.parent = parent;
        this.left = left;
        this.right = right;
    }

    @Override
    public String toString() {
        return nodeKey.toString();
    }
}
